#pragma once

#include <iostream>
#include <string>
#include <memory>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include "err.hpp"
#include "../easysock.hpp"

namespace tcp
{

class tcp_client : public inet::tcp::client
{
public:
    tcp_client(std::string sip, uint16_t sport) 
        : client(sip, sport)
    {}

    ~tcp_client()
    {
    }

    void init_server()
    {
    }

    void start()
    {
        std::string msg;
        std::cout << "please input:> ";
        getline(std::cin, msg);

        send(_sock, msg);

        std::string resp;
        ssize_t s = recv(_sock, &resp, 1024);
        if (s > 0)
        {
            std::cout << "server return " << resp << std::endl;
        }
        inet::api::Close(_sock);
    }

private:
};

}
